<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    {{mag}}
    <h1>{{ web.title }}</h1>
    <h1>{{ web.url }}</h1>
    <h1>{{number}}</h1>
    <h1>{{web.user}}</h1>
    <button v-on:click="edit1">修改</button><br>
    <!-- 简写 -->
    <button @click="edit2">修改</button>
    <hr>
    <!-- 按键修饰符 -->
    <!-- 回车 -->
    回车：<input type="text" @keyup.enter="add(40,60)"><br>
    <!-- tab必须按下去就触发，不然监听不到，因为他就直接跳到下一个对话框去了 -->
    Tab：<input type="text" @keydown.tab="add(40,60)"><br>
    <!-- 组合按键 -->
    ctrl+a：<input type="text" @keyup.ctrl.a="add(40,60)">

  </div>

  <script type="module">
    import { createApp, reactive, ref } from './vue.esm-browser.js'
    createApp({
      //setup选项 用于设置响应式数据和方法等
      setup() {
        // const number = ref(10)
        const number = ref([1., 20, 30])
        number.value = [1, 2]
        const web = reactive({
          title: "熊哥编程",
          url: "xiongge.com",
          user: 0
        })
        const edit1 = () => {
          web.url = 'www.baidu.com'
        }
        const edit2 = () => {
          web.title = '熊熊编程'
        }
        const add = (a, b) => {
          web.user += a + b
        }
        return {
          mag: "success1",
          number,
          web,
          edit1,
          edit2,
          add
        }
      }
    }).mount("#app")
  </script>
</body>

</html>